package guo.controller;

import guo.config.NacosPub;
import guo.dao.SqlDao;
import guo.service.RedisService;
import guo.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/nacosconfig")
public class NacosPubController {

    @Autowired
    private NacosPub nacosPub;

//    @Autowired
//    private SqlDao sqlDao;

    @Autowired
    RedisService redisService;



    @GetMapping("/test")
    @ResponseBody
    public R testInfo(){
        R r = R.ok().put("id", nacosPub.getId()).put("name", nacosPub.getName());
        System.out.println(r.get("id"));
        return r;
    }

    @GetMapping("/jedis")
    @ResponseBody
    public R getJedis(){

        redisService.setRedisString();
        return R.ok();
    }

    @GetMapping("/user")
    @ResponseBody
    public String toUser(){
        System.out.println("要跳转了");
        return "ok";
    }


    @GetMapping("/index")
    public String indexHtml(){
        return "index";
    }


    @PutMapping("/put/test")
    @ResponseBody
    public String putString(){
        System.out.println("put氢气");
        return "put";
    }

}
